package com.uuah.server.lifecycle.phases;

import java.util.LinkedHashSet;
import java.util.Set;

import com.uuah.api.lifecycle.IStartable;
import com.uuah.api.lifecycle.IStoppable;
import com.uuah.api.lifecycle.Initialisable;
import com.uuah.server.api.IUuahContext;
import com.uuah.server.api.component.model.IModel;
import com.uuah.server.api.component.service.IService;
import com.uuah.server.api.config.registry.IRegistry;
import com.uuah.server.api.transport.IConnector;
import com.uuah.server.lifecycle.LifecyclePhase;
import com.uuah.server.lifecycle.NotificationLifecycleObject;

/**
 * The Start phase for the Management context LifecycleManager. Calling
 * {@link com.uuah.server.api.UMOManagementContext#start()} with initiate this phase via
 * the {@link com.uuah.server.api.lifecycle.ILifecycleManager}. This phase
 * controls the order in which objects should be started.
 *
 * <p>
 * update record:updator，update time，update content and version
 * </p>
 *
 * @author <a href="jonny_quan@hotmail.com">jonny</a>
 * @date 2009 2009-3-27 下午01:49:34
 * @version 1.0.0
 */
public class UuahContextStartPhase extends LifecyclePhase {
	public UuahContextStartPhase() {
		this(new Class[] { IRegistry.class, IUuahContext.class });
	}

	public UuahContextStartPhase(Class[] ignorredObjects) {
		super(IStartable.PHASE_NAME, IStartable.class, IStoppable.PHASE_NAME);

		Set startOrderedObjects = new LinkedHashSet();
		startOrderedObjects.add(new NotificationLifecycleObject(
				IConnector.class));
		startOrderedObjects.add(new NotificationLifecycleObject(IModel.class));
		startOrderedObjects
				.add(new NotificationLifecycleObject(IService.class));
		startOrderedObjects.add(new NotificationLifecycleObject(
				IStartable.class));

		setIgnoredObjectTypes(ignorredObjects);
		setOrderedLifecycleObjects(startOrderedObjects);
		registerSupportedPhase(IStoppable.PHASE_NAME);
		registerSupportedPhase(Initialisable.PHASE_NAME);
	}
}
